import { defineStore } from 'pinia'
import { get } from '@/utils/request' 
export const useHomeStore = defineStore('home', {
  state: () => ({
    banner: '',
    list: []
  }),
  actions: {
    // 通过实际请求触发 Mock 拦截器，返回 Mock 数据    
    async getHomeData() { 
        try {         
            const res = await get('/shop/home') 
            this.banner = res.data.banner
            this.list = res.data.list
        } catch (error) {
        console.log('请求失败:', error)
        }
    }
  }
})